-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix CheckWronglyVersionedBaseUrls middleware (for landing pages) #752
Fix CheckWronglyVersionedBaseUrls middleware (for landing pages) #752
Conversation
Ensure the version part is properly checked.
Codecov Report
@@ Coverage Diff @@
## master #752 +/- ##
==========================================
- Coverage 92.72% 92.71% -0.01%
==========================================
Files 68 68
Lines 3668 3666 -2
==========================================
- Hits 3401 3399 -2
Misses 267 267
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be tricky, but is there any way we can add a middleware test that checks for the original bug? It's still not clear to me why localhost:5000/v1
would cause a VersionNotSupported
error before these changes
Yeah. I've been looking into this for a while now today, and it all comes back to the issue of not being able to test non-JSON endpoints, i.e., we cannot properly test the landing page endpoints using Starlette's So I am in the process of trying to simply turn to using a different As a note, I also found we're not using a landing page for the index meta-database. |
Gah. I've come to the conclusion this will require a proper update of the way we test at the moment. We would need to move to testing with an asynchronous client, completely, which would turn many of the actual test functions into async functions themselves. We should make this part of turning it all asynchronous, in the future, I think - keeping specific functions and capabilities synchronous if the backend driver does not support it? |
There is something I don't really understand here though. And that's that the core issue comes from an |
Ensure `version` is correctly set for test client.
I checked the new test implemented in 5022573 locally after rebasing and dropping the first two commits and it indeed failed. So it successfully tests that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your hard work @CasperWA, sounds pretty tricky.
A simple option might be to configure the landing page (so that it can be disabled in the case of the test client), i.e. it could serve a JSON landing page or otherwise. I can't say I fully understand the technical details of these issues so I will leave it up to you to decide the best course of action.
👍
As hinted above, I'd prefer to move to a fully asynchronous test suite, where possible. Use a framework-agnostic test client like either of the packages supply mentioned above and go through both the code base and the tests to make everything asynchronous that can be asynchronous. |
Ensure the version part is properly checked.
Fixes #737.